package com.example.haoyundaoyonghu;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import android.util.Log;
import android.widget.ImageView;

import androidx.multidex.MultiDex;

import com.bumptech.glide.Glide;

import com.guoxiaoxing.phoenix.core.listener.ImageLoader;
import com.guoxiaoxing.phoenix.picker.Phoenix;
import com.vise.xsnow.http.ViseHttp;
import com.vise.xsnow.http.interceptor.HttpLogInterceptor;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;

import okhttp3.Response;

public class MyApp extends Application {
    private static MyApp mApp;
    public static Application instance;
    public static Application getInstance() {
        return instance;
    }
    @Override
    public void onCreate() {
        super.onCreate();
        mApp = this;
        // 初始化MultiDex
        MultiDex.install(this);

        Phoenix.config()
                .imageLoader(new ImageLoader() {
                    @Override
                    public void loadImage(Context context, ImageView imageView, String imagePath, int type) {
                        Glide.with(context)
                                .load(imagePath)
                                .into(imageView);
                    }
                });
        instance = this;
        initNet();
    }
    public static MyApp getApp() {
        return mApp;
    }
    private void initNet() {

        ViseHttp.init(this);
        ViseHttp.CONFIG()
                //配置请求主机地址

                .baseUrl("http://192.168.2.252:8080/")
                .setCookie(true)
                //配置日志拦截器
                .interceptor(new HttpLogInterceptor()
                        .setLevel(HttpLogInterceptor.Level.BODY));

    }
}
